import request from '@/utils/request'

/**
 * 获取公司部门
 * @param
 * @returns
 */
export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

/**
 * 根据id查询单个部门信息
 * @param
 * @returns
 */
export function getDepartmentsDetail(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}

/**
 * 新增子部门
 * @param
 * @returns
 */
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 * 修改部门
 * @param
 * @returns
 */
export function updateDepartments(id, data) {
  return request({
    url: `/company/department/${id}`,
    method: 'put',
    data
  })
}

/**
 * 删除部门
 * @param
 * @returns
 */
export function deleteDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
